import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}
//获取用户列表
export function listUser(data, pageNum, pageSize) {
  return request({
    url: '/user/list',
    method: 'post',
    params: {
      pageNum: pageNum,
      pageSize: pageSize
    },
    data: data,
  })
}
//getByid
export function getUserById(id) {
  return request({
    url: '/user/' + id,
    method: 'get',
  })
}
//updateUser
export function updateUser(data) {
  return request({
    url: '/user/update',
    method: 'post',
    data
  })
}
//添加用户
export function addUser(data) {
  return request({
    url: '/user/add',
    method: 'post',
    data
  })
}
delUser
export function delUser(ids) {
  return request({
    url: '/user/delete/' + ids,
    method: 'delete',
  })
}

export function getInfo() {
  return request({
    url: '/user/info',
    method: 'get',
    //  params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
